<template>
  <header class="header">
    <h1>todos</h1>
    <input
      class="new-todo"
      placeholder="请输入任务名称"
      autofocus
      v-model="red"
      @change="fn"
    />
  </header>
</template>
<script>
export default {
  name: 'HmHeader',
  props: {
    list: {
      type: Array,
      required: true
    }
  },
  data () {
    return {
      red: ''
    }
  },
  methods: {
    fn () {
      const obj = {
        id: +new Date(),
        name: this.red,
        isDone: false
      }
      this.$emit('fn', obj)
      this.red=''
    }
  }
}
</script>

<style scoped lang="less"></style>
